package com.demo.model.base;

import lombok.Data;

/**
 * Author:  Hardy
 * Date:    2018/7/18 20:05
 * Description: Rest Api 统一返基础类
 **/
@Data
public class RestResponse<T> {

    private long createAt;

    private int code;

    private String message;

    private T data;

    public RestResponse() {
        this.createAt = System.currentTimeMillis() / 1000;
    }

    public RestResponse(int code) {
        this.createAt = System.currentTimeMillis() / 1000;
        this.code = code;
    }

    public RestResponse(int code, String message) {
        this.createAt = System.currentTimeMillis() / 1000;
        this.code = code;
        this.message = message;
    }

    public RestResponse data(T data) {
        this.data = data;
        return this;
    }
}

